import unittest
import time
from 贪心算法alg import product_except_self

class TestProductExceptSelf(unittest.TestCase):
    def test_example(self):
        arrayA = [2, 4, 6, 8, 10]
        expected = [1920, 960, 640, 480, 384]
        self.assertEqual(product_except_self(arrayA), expected)
    
    def test_with_zero(self):
        arrayA = [0, 2, 3]
        expected = [6, 0, 0]
        self.assertEqual(product_except_self(arrayA), expected)
    
    def test_with_negatives(self):
        arrayA = [-1, 2, -3]
        expected = [-6, 3, -2]
        self.assertEqual(product_except_self(arrayA), expected)
    
    def test_single_element(self):
        arrayA = [5]
        expected = [1]
        self.assertEqual(product_except_self(arrayA), expected)
    
    def test_all_ones(self):
        arrayA = [1, 1, 1]
        expected = [1, 1, 1]
        self.assertEqual(product_except_self(arrayA), expected)
    
    def test_large_input_performance(self):
        n = 100000
        arrayA = [1] * n
        start_time = time.time()
        product_except_self(arrayA)
        end_time = time.time()
        self.assertLess(end_time - start_time, 1.0, "Performance check")

if __name__ == '__main__':
    unittest.main()    